home *** CD-ROM | disk | FTP | other *** search
/ Team Palmtops 7 / Palmtops_numero07.iso / WinCE / SDKWindowsCE / HandHeldPCPro30 / sdk.exe / Jupiter SDK / data1.cab / Emulation_Include_Files / objbase.h < prev    next >
Encoding:
C/C++ Source or Header  |  1999-02-19  |  29.9 KB  |  881 lines

  1. //+---------------------------------------------------------------------------
  2. //
  3. //  Microsoft Windows
  4. //  Copyright (c) 1992-1998. Microsoft Corporation.  All Rights Reserved.
  5. //
  6. //  File:       objbase.h
  7. //
  8. //  Contents:   Component object model defintions.
  9. //
  10. //----------------------------------------------------------------------------
  11.  
  12. #include <rpc.h>
  13. #include <rpcndr.h>
  14.  
  15. #if !defined( _OBJBASE_H_ )
  16. #define _OBJBASE_H_
  17.  
  18. #include <pshpack8.h>
  19.  
  20.  
  21. #define COM_NO_WINDOWS_H
  22.  
  23. // Some definitions so we can include the real wtypes.h from nt
  24.  
  25. typedef void __RPC_FAR * RPC_IF_HANDLE;
  26. #define __RPC_FAR
  27. //#define __RPC_USER
  28. typedef void __RPC_FAR * RPC_IF_HANDLE;
  29. #define PRPC_MESSAGE int
  30. #define hyper _int64
  31. #define MIDL_uhyper unsigned _int64
  32. #ifndef _FILETIME_
  33. #define _FILETIME_
  34. #endif
  35. #ifndef _SYSTEMTIME_
  36. #define _SYSTEMTIME_
  37. #endif
  38. #define UUID GUID
  39. #define _SECURITY_ATTRIBUTES_
  40. typedef void  * RPC_AUTH_IDENTITY_HANDLE;
  41. typedef void  * RPC_AUTHZ_HANDLE;
  42.  
  43.  
  44. #ifdef _MAC
  45. #ifndef _WLM_NOFORCE_LIBS
  46.  
  47. #ifdef _WLMDLL
  48.         #ifdef _DEBUG
  49.                 #pragma comment(lib, "oledlgd.lib")
  50.                 #pragma comment(lib, "msvcoled.lib")
  51.         #else
  52.                 #pragma comment(lib, "oledlg.lib")
  53.                 #pragma comment(lib, "msvcole.lib")
  54.         #endif
  55. #else
  56.         #ifdef _DEBUG
  57.                 #pragma comment(lib, "wlmoled.lib")
  58.                 #pragma comment(lib, "ole2uid.lib")
  59.         #else
  60.                 #pragma comment(lib, "wlmole.lib")
  61.                 #pragma comment(lib, "ole2ui.lib")
  62.         #endif
  63.         #pragma data_seg(".drectve")
  64.         static char _gszWlmOLEUIResourceDirective[] = "/macres:ole2ui.rsc";
  65.         #pragma data_seg()
  66. #endif
  67.  
  68. #pragma comment(lib, "uuid.lib")
  69.  
  70. #ifdef _DEBUG
  71.     #pragma comment(lib, "ole2d.lib")
  72.     #pragma comment(lib, "ole2autd.lib")
  73. #else
  74.     #pragma comment(lib, "ole2.lib")
  75.     #pragma comment(lib, "ole2auto.lib")
  76. #endif
  77.  
  78. #endif // !_WLM_NOFORCE_LIBS
  79. #endif // _MAC
  80.  
  81. // Component Object Model defines, and macros
  82.  
  83. #ifdef __cplusplus
  84.     #define EXTERN_C    extern "C"
  85. #else
  86.     #define EXTERN_C    extern
  87. #endif
  88.  
  89. #if defined(_WIN32) || defined(_MPPC_)
  90.  
  91. // Win32 doesn't support __export
  92.  
  93. #ifdef _68K_
  94. #define STDMETHODCALLTYPE       __cdecl
  95. #else
  96. #define STDMETHODCALLTYPE       __stdcall
  97. #endif
  98. #define STDMETHODVCALLTYPE      __cdecl
  99.  
  100. #define STDAPICALLTYPE          __stdcall
  101. #define STDAPIVCALLTYPE         __cdecl
  102.  
  103. #else
  104.  
  105. #define STDMETHODCALLTYPE       __export __stdcall
  106. #define STDMETHODVCALLTYPE      __export __cdecl
  107.  
  108. #define STDAPICALLTYPE          __export __stdcall
  109. #define STDAPIVCALLTYPE         __export __cdecl
  110.  
  111. #endif
  112.  
  113.  
  114. #define STDAPI                  EXTERN_C HRESULT STDAPICALLTYPE
  115. #define STDAPI_(type)           EXTERN_C type STDAPICALLTYPE
  116.  
  117. #define STDMETHODIMP            HRESULT STDMETHODCALLTYPE
  118. #define STDMETHODIMP_(type)     type STDMETHODCALLTYPE
  119.  
  120. // The 'V' versions allow Variable Argument lists.
  121.  
  122. #define STDAPIV                 EXTERN_C HRESULT STDAPIVCALLTYPE
  123. #define STDAPIV_(type)          EXTERN_C type STDAPIVCALLTYPE
  124.  
  125. #define STDMETHODIMPV           HRESULT STDMETHODVCALLTYPE
  126. #define STDMETHODIMPV_(type)    type STDMETHODVCALLTYPE
  127.  
  128. #ifdef _OLE32_
  129. #define WINOLEAPI        STDAPI
  130. #define WINOLEAPI_(type) STDAPI_(type)
  131. #else
  132.  
  133. #ifdef _68K_
  134. #ifndef REQUIRESAPPLEPASCAL
  135. #define WINOLEAPI        EXTERN_C DECLSPEC_IMPORT HRESULT PASCAL
  136. #define WINOLEAPI_(type) EXTERN_C DECLSPEC_IMPORT type PASCAL
  137. #else
  138. #define WINOLEAPI        EXTERN_C DECLSPEC_IMPORT PASCAL HRESULT
  139. #define WINOLEAPI_(type) EXTERN_C DECLSPEC_IMPORT PASCAL type
  140. #endif
  141. #else
  142. #define WINOLEAPI        EXTERN_C DECLSPEC_IMPORT HRESULT STDAPICALLTYPE
  143. #define WINOLEAPI_(type) EXTERN_C DECLSPEC_IMPORT type STDAPICALLTYPE
  144. #endif
  145.  
  146. #endif
  147.  
  148. /****** Interface Declaration ***********************************************/
  149.  
  150. /*
  151.  *      These are macros for declaring interfaces.  They exist so that
  152.  *      a single definition of the interface is simulataneously a proper
  153.  *      declaration of the interface structures (C++ abstract classes)
  154.  *      for both C and C++.
  155.  *
  156.  *      DECLARE_INTERFACE(iface) is used to declare an interface that does
  157.  *      not derive from a base interface.
  158.  *      DECLARE_INTERFACE_(iface, baseiface) is used to declare an interface
  159.  *      that does derive from a base interface.
  160.  *
  161.  *      By default if the source file has a .c extension the C version of
  162.  *      the interface declaratations will be expanded; if it has a .cpp
  163.  *      extension the C++ version will be expanded. if you want to force
  164.  *      the C version expansion even though the source file has a .cpp
  165.  *      extension, then define the macro "CINTERFACE".
  166.  *      eg.     cl -DCINTERFACE file.cpp
  167.  *
  168.  *      Example Interface declaration:
  169.  *
  170.  *          #undef  INTERFACE
  171.  *          #define INTERFACE   IClassFactory
  172.  *
  173.  *          DECLARE_INTERFACE_(IClassFactory, IUnknown)
  174.  *          {
  175.  *              // *** IUnknown methods ***
  176.  *              STDMETHOD(QueryInterface) (THIS_
  177.  *                                        REFIID riid,
  178.  *                                        LPVOID FAR* ppvObj) PURE;
  179.  *              STDMETHOD_(ULONG,AddRef) (THIS) PURE;
  180.  *              STDMETHOD_(ULONG,Release) (THIS) PURE;
  181.  *
  182.  *              // *** IClassFactory methods ***
  183.  *              STDMETHOD(CreateInstance) (THIS_
  184.  *                                        LPUNKNOWN pUnkOuter,
  185.  *                                        REFIID riid,
  186.  *                                        LPVOID FAR* ppvObject) PURE;
  187.  *          };
  188.  *
  189.  *      Example C++ expansion:
  190.  *
  191.  *          struct FAR IClassFactory : public IUnknown
  192.  *          {
  193.  *              virtual HRESULT STDMETHODCALLTYPE QueryInterface(
  194.  *                                                  IID FAR& riid,
  195.  *                                                  LPVOID FAR* ppvObj) = 0;
  196.  *              virtual HRESULT STDMETHODCALLTYPE AddRef(void) = 0;
  197.  *              virtual HRESULT STDMETHODCALLTYPE Release(void) = 0;
  198.  *              virtual HRESULT STDMETHODCALLTYPE CreateInstance(
  199.  *                                              LPUNKNOWN pUnkOuter,
  200.  *                                              IID FAR& riid,
  201.  *                                              LPVOID FAR* ppvObject) = 0;
  202.  *          };
  203.  *
  204.  *          NOTE: Our documentation says '#define interface class' but we use
  205.  *          'struct' instead of 'class' to keep a lot of 'public:' lines
  206.  *          out of the interfaces.  The 'FAR' forces the 'this' pointers to
  207.  *          be far, which is what we need.
  208.  *
  209.  *      Example C expansion:
  210.  *
  211.  *          typedef struct IClassFactory
  212.  *          {
  213.  *              const struct IClassFactoryVtbl FAR* lpVtbl;
  214.  *          } IClassFactory;
  215.  *
  216.  *          typedef struct IClassFactoryVtbl IClassFactoryVtbl;
  217.  *
  218.  *          struct IClassFactoryVtbl
  219.  *          {
  220.  *              HRESULT (STDMETHODCALLTYPE * QueryInterface) (
  221.  *                                                  IClassFactory FAR* This,
  222.  *                                                  IID FAR* riid,
  223.  *                                                  LPVOID FAR* ppvObj) ;
  224.  *              HRESULT (STDMETHODCALLTYPE * AddRef) (IClassFactory FAR* This) ;
  225.  *              HRESULT (STDMETHODCALLTYPE * Release) (IClassFactory FAR* This) ;
  226.  *              HRESULT (STDMETHODCALLTYPE * CreateInstance) (
  227.  *                                                  IClassFactory FAR* This,
  228.  *                                                  LPUNKNOWN pUnkOuter,
  229.  *                                                  IID FAR* riid,
  230.  *                                                  LPVOID FAR* ppvObject);
  231.  *              HRESULT (STDMETHODCALLTYPE * LockServer) (
  232.  *                                                  IClassFactory FAR* This,
  233.  *                                                  BOOL fLock);
  234.  *          };
  235.  */
  236.  
  237. #if defined(__cplusplus) && !defined(CINTERFACE)
  238. //#define interface               struct FAR
  239. #define interface struct
  240. #define STDMETHOD(method)       virtual HRESULT STDMETHODCALLTYPE method
  241. #define STDMETHOD_(type,method) virtual type STDMETHODCALLTYPE method
  242. #define PURE                    = 0
  243. #define THIS_
  244. #define THIS                    void
  245. #define DECLARE_INTERFACE(iface)    interface iface
  246. #define DECLARE_INTERFACE_(iface, baseiface)    interface iface : public baseiface
  247.  
  248.  
  249. #if !defined(BEGIN_INTERFACE)
  250. #if defined(_MPPC_)  && \
  251.     ( (defined(_MSC_VER) || defined(__SC__) || defined(__MWERKS__)) && \
  252.     !defined(NO_NULL_VTABLE_ENTRY) )
  253.    #define BEGIN_INTERFACE virtual void a() {}
  254.    #define END_INTERFACE
  255. #else
  256.    #define BEGIN_INTERFACE
  257.    #define END_INTERFACE
  258. #endif
  259. #endif
  260.  
  261. #else
  262.  
  263. #define interface               struct
  264.  
  265. #define STDMETHOD(method)       HRESULT (STDMETHODCALLTYPE * method)
  266. #define STDMETHOD_(type,method) type (STDMETHODCALLTYPE * method)
  267.  
  268. #if !defined(BEGIN_INTERFACE)
  269. #if defined(_MPPC_)
  270.     #define BEGIN_INTERFACE       void    *b;
  271.     #define END_INTERFACE
  272. #else
  273.     #define BEGIN_INTERFACE
  274.     #define END_INTERFACE
  275. #endif
  276. #endif
  277.  
  278.  
  279. #define PURE
  280. #define THIS_                   INTERFACE FAR* This,
  281. #define THIS                    INTERFACE FAR* This
  282. #ifdef CONST_VTABLE
  283. #undef CONST_VTBL
  284. #define CONST_VTBL const
  285. #define DECLARE_INTERFACE(iface)    typedef interface iface { \
  286.                                     const struct iface##Vtbl FAR* lpVtbl; \
  287.                                 } iface; \
  288.                                 typedef const struct iface##Vtbl iface##Vtbl; \
  289.                                 const struct iface##Vtbl
  290. #else
  291. #undef CONST_VTBL
  292. #define CONST_VTBL
  293. #define DECLARE_INTERFACE(iface)    typedef interface iface { \
  294.                                     struct iface##Vtbl FAR* lpVtbl; \
  295.                                 } iface; \
  296.                                 typedef struct iface##Vtbl iface##Vtbl; \
  297.                                 struct iface##Vtbl
  298. #endif
  299. #define DECLARE_INTERFACE_(iface, baseiface)    DECLARE_INTERFACE(iface)
  300.  
  301. #endif
  302.  
  303.  
  304.  
  305.  
  306. /****** Additional basic types **********************************************/
  307.  
  308.  
  309. #ifndef FARSTRUCT
  310. #ifdef __cplusplus
  311. #define FARSTRUCT   FAR
  312. #else
  313. #define FARSTRUCT
  314. #endif  // __cplusplus
  315. #endif  // FARSTRUCT
  316.  
  317.  
  318.  
  319. #ifndef HUGEP
  320. #if defined(_WIN32) || defined(_MPPC_)
  321. #define HUGEP
  322. #else
  323. #define HUGEP __huge
  324. #endif // WIN32
  325. #endif // HUGEP
  326.  
  327.  
  328. #ifdef _MAC
  329. #if !defined(OLE2ANSI)
  330. #define OLE2ANSI
  331. #endif
  332. #endif
  333.  
  334. #include <stdlib.h>
  335.  
  336. #define LISet32(li, v) ((li).HighPart = (v) < 0 ? -1 : 0, (li).LowPart = (v))
  337.  
  338. #define ULISet32(li, v) ((li).HighPart = 0, (li).LowPart = (v))
  339.  
  340.  
  341.  
  342.  
  343.  
  344.  
  345. #define CLSCTX_INPROC           (CLSCTX_INPROC_SERVER|CLSCTX_INPROC_HANDLER)
  346.  
  347. // With DCOM, CLSCTX_REMOTE_SERVER should be included
  348. #if (_WIN32_WINNT >= 0x0400 ) || defined(_WIN32_DCOM) // DCOM
  349. #define CLSCTX_ALL              (CLSCTX_INPROC_SERVER| \
  350.                                  CLSCTX_INPROC_HANDLER| \
  351.                                  CLSCTX_LOCAL_SERVER| \
  352.                                  CLSCTX_REMOTE_SERVER)
  353.  
  354. #define CLSCTX_SERVER           (CLSCTX_INPROC_SERVER|CLSCTX_LOCAL_SERVER|CLSCTX_REMOTE_SERVER)
  355. #else
  356. #define CLSCTX_ALL              (CLSCTX_INPROC_SERVER| \
  357.                                  CLSCTX_INPROC_HANDLER| \
  358.                                  CLSCTX_LOCAL_SERVER )
  359.  
  360. #define CLSCTX_SERVER           (CLSCTX_INPROC_SERVER|CLSCTX_LOCAL_SERVER)
  361. #endif
  362.  
  363.  
  364. // class registration flags; passed to CoRegisterClassObject
  365. typedef enum tagREGCLS
  366. {
  367.     REGCLS_SINGLEUSE = 0,       // class object only generates one instance
  368.     REGCLS_MULTIPLEUSE = 1,     // same class object genereates multiple inst.
  369.                                 // and local automatically goes into inproc tbl.
  370.     REGCLS_MULTI_SEPARATE = 2,  // multiple use, but separate control over each
  371.                                 // context.
  372.     REGCLS_SUSPENDED      = 4   // register is as suspended, will be activated
  373.                                 // when app calls CoResumeClassObjects
  374. } REGCLS;
  375.  
  376. // interface marshaling definitions
  377. #define MARSHALINTERFACE_MIN 500 // minimum number of bytes for interface marshl
  378.  
  379.  
  380. //
  381. // Common typedefs for paramaters used in Storage API's, gleamed from storage.h
  382. // Also contains Storage error codes, which should be moved into the storage
  383. // idl files.
  384. //
  385.  
  386.  
  387. #define CWCSTORAGENAME 32
  388.  
  389. /* Storage instantiation modes */
  390. #define STGM_DIRECT             0x00000000L
  391. #define STGM_TRANSACTED         0x00010000L
  392. #define STGM_SIMPLE             0x08000000L
  393.  
  394. #define STGM_READ               0x00000000L
  395. #define STGM_WRITE              0x00000001L
  396. #define STGM_READWRITE          0x00000002L
  397.  
  398. #define STGM_SHARE_DENY_NONE    0x00000040L
  399. #define STGM_SHARE_DENY_READ    0x00000030L
  400. #define STGM_SHARE_DENY_WRITE   0x00000020L
  401. #define STGM_SHARE_EXCLUSIVE    0x00000010L
  402.  
  403. #define STGM_PRIORITY           0x00040000L
  404. #define STGM_DELETEONRELEASE    0x04000000L
  405. #if (WINVER >= 400)
  406. #define STGM_NOSCRATCH          0x00100000L
  407. #endif /* WINVER */
  408.  
  409. #define STGM_CREATE             0x00001000L
  410. #define STGM_CONVERT            0x00020000L
  411. #define STGM_FAILIFTHERE        0x00000000L
  412.  
  413. #define STGM_NOSNAPSHOT         0x00200000L
  414.  
  415. /*  flags for internet asyncronous and layout docfile */
  416. #define ASYNC_MODE_COMPATIBILITY    0x00000001L
  417. #define ASYNC_MODE_DEFAULT          0x00000000L
  418.  
  419. #define STGTY_REPEAT                0x00000100L
  420. #define STG_TOEND                   0xFFFFFFFFL
  421.  
  422. #define STG_LAYOUT_SEQUENTIAL       0x00000000L
  423. #define STG_LAYOUT_INTERLEAVED      0x00000001L
  424.  
  425.  
  426.  
  427.  
  428. /* here is where we pull in the MIDL generated headers for the interfaces */
  429. typedef interface    IRpcStubBuffer     IRpcStubBuffer;
  430. typedef interface    IRpcChannelBuffer  IRpcChannelBuffer;
  431.  
  432. #include <wtypes.h>
  433. #include <unknwn.h>
  434. #include <objidl.h>
  435.  
  436.  
  437. // macros to define byte pattern for a GUID.
  438. //      Example: DEFINE_GUID(GUID_XXX, a, b, c, ...);
  439. //
  440. // Each dll/exe must initialize the GUIDs once.  This is done in one of
  441. // two ways.  If you are not using precompiled headers for the file(s) which
  442. // initializes the GUIDs, define INITGUID before including objbase.h.  This
  443. // is how OLE builds the initialized versions of the GUIDs which are included
  444. // in ole2.lib.  The GUIDs in ole2.lib are all defined in the same text
  445. // segment GUID_TEXT.
  446. //
  447. // The alternative (which some versions of the compiler don't handle properly;
  448. // they wind up with the initialized GUIDs in a data, not a text segment),
  449. // is to use a precompiled version of objbase.h and then include initguid.h
  450. // after objbase.h followed by one or more of the guid defintion files.
  451.  
  452. #ifndef INITGUID
  453. #define DEFINE_GUID(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
  454.     EXTERN_C const GUID FAR name
  455. #else
  456.  
  457. #define DEFINE_GUID(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
  458.         EXTERN_C const GUID name \
  459.                 = { l, w1, w2, { b1, b2,  b3,  b4,  b5,  b6,  b7,  b8 } }
  460. #endif // INITGUID
  461.  
  462. #define DEFINE_OLEGUID(name, l, w1, w2) \
  463.     DEFINE_GUID(name, l, w1, w2, 0xC0,0,0,0,0,0,0,0x46)
  464.  
  465. #ifdef _OLE32_
  466.  
  467.  
  468. // Faster (but makes code fatter) inline version...use sparingly
  469. #ifdef __cplusplus
  470. inline BOOL  InlineIsEqualGUID(REFGUID rguid1, REFGUID rguid2)
  471. {
  472.    return (
  473.       ((PLONG) &rguid1)[0] == ((PLONG) &rguid2)[0] &&
  474.       ((PLONG) &rguid1)[1] == ((PLONG) &rguid2)[1] &&
  475.       ((PLONG) &rguid1)[2] == ((PLONG) &rguid2)[2] &&
  476.       ((PLONG) &rguid1)[3] == ((PLONG) &rguid2)[3]);
  477. }
  478. #else   // ! __cplusplus
  479. #define InlineIsEqualGUID(rguid1, rguid2)  \
  480.         (((PLONG) rguid1)[0] == ((PLONG) rguid2)[0] &&   \
  481.         ((PLONG) rguid1)[1] == ((PLONG) rguid2)[1] &&    \
  482.         ((PLONG) rguid1)[2] == ((PLONG) rguid2)[2] &&    \
  483.         ((PLONG) rguid1)[3] == ((PLONG) rguid2)[3])
  484. #endif  // __cplusplus
  485.  
  486. #ifdef _OLE32PRIV_
  487. BOOL _fastcall wIsEqualGUID(REFGUID rguid1, REFGUID rguid2);
  488. #define IsEqualGUID(rguid1, rguid2) wIsEqualGUID(rguid1, rguid2)
  489. #else
  490. #define IsEqualGUID(rguid1, rguid2) InlineIsEqualGUID(rguid1, rguid2)
  491. #endif  // _OLE32PRIV_
  492.  
  493. #else   // ! _OLE32_
  494. #ifdef __cplusplus
  495. inline BOOL IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
  496. {
  497.     return !memcmp(&rguid1, &rguid2, sizeof(GUID));
  498. }
  499. #else   //  ! __cplusplus
  500. #define IsEqualGUID(rguid1, rguid2) (!memcmp(rguid1, rguid2, sizeof(GUID)))
  501. #endif  //  __cplusplus
  502. #endif  //  _OLE32_
  503.  
  504. #define IsEqualIID(riid1, riid2) IsEqualGUID(riid1, riid2)
  505. #define IsEqualCLSID(rclsid1, rclsid2) IsEqualGUID(rclsid1, rclsid2)
  506.  
  507. #ifdef __cplusplus
  508.  
  509. // because GUID is defined elsewhere in WIN32 land, the operator == and !=
  510. // are moved outside the class to global scope.
  511.  
  512. #ifdef _OLE32_
  513. inline BOOL operator==(const GUID& guidOne, const GUID& guidOther)
  514. {
  515.     return IsEqualGUID(guidOne,guidOther);
  516. }
  517. #else   // !_OLE32_
  518. inline BOOL operator==(const GUID& guidOne, const GUID& guidOther)
  519. {
  520. #ifdef _WIN32
  521.     return !memcmp(&guidOne,&guidOther,sizeof(GUID));
  522. #else
  523.     return !_fmemcmp(&guidOne,&guidOther,sizeof(GUID)); }
  524. #endif
  525. }
  526. #endif // _OLE32_
  527.  
  528. inline BOOL operator!=(const GUID& guidOne, const GUID& guidOther)
  529. {
  530.     return !(guidOne == guidOther);
  531. }
  532.  
  533. #endif // __cpluscplus
  534.  
  535.  
  536. #ifndef INITGUID
  537. #include <cguid.h>
  538. #endif
  539.  
  540. // COM initialization flags; passed to CoInitialize.
  541. typedef enum tagCOINIT
  542. {
  543.   COINIT_APARTMENTTHREADED  = 0x2,      // Apartment model
  544.   COINIT_MULTITHREADED      = 0x0,      // OLE calls objects on any thread.
  545.  
  546. #if  (_WIN32_WINNT >= 0x0400 ) || defined(_WIN32_DCOM) // DCOM
  547.   // These constants are only valid on Windows NT 4.0
  548.   COINIT_DISABLE_OLE1DDE    = 0x4,      // Don't use DDE for Ole1 support.
  549.   COINIT_SPEED_OVER_MEMORY  = 0x8,      // Trade memory for speed.
  550. #endif // DCOM
  551. } COINIT;
  552.  
  553.  
  554.  
  555.  
  556.  
  557. /****** STD Object API Prototypes *****************************************/
  558.  
  559. WINOLEAPI_(DWORD) CoBuildVersion( VOID );
  560.  
  561. /* init/uninit */
  562.  
  563. WINOLEAPI  CoInitialize(LPVOID pvReserved);
  564. WINOLEAPI_(void)  CoUninitialize(void);
  565. WINOLEAPI  CoGetMalloc(DWORD dwMemContext, LPMALLOC FAR* ppMalloc);
  566. WINOLEAPI_(DWORD) CoGetCurrentProcess(void);
  567. WINOLEAPI  CoRegisterMallocSpy(LPMALLOCSPY pMallocSpy);
  568. WINOLEAPI  CoRevokeMallocSpy(void);
  569. WINOLEAPI  CoCreateStandardMalloc(DWORD memctx, IMalloc FAR* FAR* ppMalloc);
  570.  
  571. WINOLEAPI  CoInitializeEx(LPVOID pvReserved, DWORD dwCoInit);
  572.  
  573. #if DBG == 1
  574. WINOLEAPI_(ULONG) DebugCoGetRpcFault( void );
  575. WINOLEAPI_(void) DebugCoSetRpcFault( ULONG );
  576. #endif
  577.  
  578. /* register/revoke/get class objects */
  579.  
  580. WINOLEAPI  CoGetClassObject(REFCLSID rclsid, DWORD dwClsContext, LPVOID pvReserved,
  581.                     REFIID riid, LPVOID FAR* ppv);
  582. WINOLEAPI  CoRegisterClassObject(REFCLSID rclsid, LPUNKNOWN pUnk,
  583.                     DWORD dwClsContext, DWORD flags, LPDWORD lpdwRegister);
  584. WINOLEAPI  CoRevokeClassObject(DWORD dwRegister);
  585. WINOLEAPI  CoResumeClassObjects(void);
  586. WINOLEAPI  CoSuspendClassObjects(void);
  587. WINOLEAPI_(ULONG) CoAddRefServerProcess(void);
  588. WINOLEAPI_(ULONG) CoReleaseServerProcess(void);
  589. WINOLEAPI  CoGetPSClsid(REFIID riid, CLSID *pClsid);
  590. WINOLEAPI  CoRegisterPSClsid(REFIID riid, REFCLSID rclsid);
  591.  
  592. /* marshaling interface pointers */
  593.  
  594. WINOLEAPI CoGetMarshalSizeMax(ULONG *pulSize, REFIID riid, LPUNKNOWN pUnk,
  595.                     DWORD dwDestContext, LPVOID pvDestContext, DWORD mshlflags);
  596. WINOLEAPI CoMarshalInterface(LPSTREAM pStm, REFIID riid, LPUNKNOWN pUnk,
  597.                     DWORD dwDestContext, LPVOID pvDestContext, DWORD mshlflags);
  598. WINOLEAPI CoUnmarshalInterface(LPSTREAM pStm, REFIID riid, LPVOID FAR* ppv);
  599. WINOLEAPI CoMarshalHresult(LPSTREAM pstm, HRESULT hresult);
  600. WINOLEAPI CoUnmarshalHresult(LPSTREAM pstm, HRESULT FAR * phresult);
  601. WINOLEAPI CoReleaseMarshalData(LPSTREAM pStm);
  602. WINOLEAPI CoDisconnectObject(LPUNKNOWN pUnk, DWORD dwReserved);
  603. WINOLEAPI CoLockObjectExternal(LPUNKNOWN pUnk, BOOL fLock, BOOL fLastUnlockReleases);
  604. WINOLEAPI CoGetStandardMarshal(REFIID riid, LPUNKNOWN pUnk,
  605.                     DWORD dwDestContext, LPVOID pvDestContext, DWORD mshlflags,
  606.                     LPMARSHAL FAR* ppMarshal);
  607.  
  608. WINOLEAPI_(BOOL) CoIsHandlerConnected(LPUNKNOWN pUnk);
  609. WINOLEAPI_(BOOL) CoHasStrongExternalConnections(LPUNKNOWN pUnk);
  610.  
  611. // Apartment model inter-thread interface passing helpers
  612. WINOLEAPI CoMarshalInterThreadInterfaceInStream(REFIID riid, LPUNKNOWN pUnk,
  613.                     LPSTREAM *ppStm);
  614.  
  615. WINOLEAPI CoGetInterfaceAndReleaseStream(LPSTREAM pStm, REFIID iid,
  616.                     LPVOID FAR* ppv);
  617.  
  618. WINOLEAPI CoCreateFreeThreadedMarshaler(LPUNKNOWN  punkOuter,
  619.                     LPUNKNOWN *ppunkMarshal);
  620.  
  621. /* dll loading helpers; keeps track of ref counts and unloads all on exit */
  622.  
  623. WINOLEAPI_(HINSTANCE) CoLoadLibrary(LPOLESTR lpszLibName, BOOL bAutoFree);
  624. //WINOLEAPI_(void) CoFreeLibrary(HINSTANCE hInst); // unsafe & not supported any more. Use CoFreeUnusedLibraries()
  625. WINOLEAPI_(void) CoFreeAllLibraries(void);
  626. WINOLEAPI_(void) CoFreeUnusedLibraries(void);
  627.  
  628.  
  629. #if (_WIN32_WINNT >= 0x0400 ) || defined(_WIN32_DCOM) // DCOM
  630.  
  631. /* Call Security. */
  632.  
  633. WINOLEAPI CoInitializeSecurity(
  634.                     PSECURITY_DESCRIPTOR         pSecDesc,
  635.                     LONG                         cAuthSvc,
  636.                     SOLE_AUTHENTICATION_SERVICE *asAuthSvc,
  637.                     void                        *pReserved1,
  638.                     DWORD                        dwAuthnLevel,
  639.                     DWORD                        dwImpLevel,
  640.                     void                        *pReserved2,
  641.                     DWORD                        dwCapabilities,
  642.                     void                        *pReserved3 );
  643. WINOLEAPI CoGetCallContext( REFIID riid, void **ppInterface );
  644. WINOLEAPI CoQueryProxyBlanket(
  645.     IUnknown                  *pProxy,
  646.     DWORD                     *pwAuthnSvc,
  647.     DWORD                     *pAuthzSvc,
  648.     OLECHAR                  **pServerPrincName,
  649.     DWORD                     *pAuthnLevel,
  650.     DWORD                     *pImpLevel,
  651.     RPC_AUTH_IDENTITY_HANDLE  *pAuthInfo,
  652.     DWORD                     *pCapabilites );
  653. WINOLEAPI CoSetProxyBlanket(
  654.     IUnknown                 *pProxy,
  655.     DWORD                     dwAuthnSvc,
  656.     DWORD                     dwAuthzSvc,
  657.     OLECHAR                  *pServerPrincName,
  658.     DWORD                     dwAuthnLevel,
  659.     DWORD                     dwImpLevel,
  660.     RPC_AUTH_IDENTITY_HANDLE  pAuthInfo,
  661.     DWORD                     dwCapabilities );
  662. WINOLEAPI CoCopyProxy(
  663.     IUnknown    *pProxy,
  664.     IUnknown   **ppCopy );
  665. WINOLEAPI CoQueryClientBlanket(
  666.     DWORD             *pAuthnSvc,
  667.     DWORD             *pAuthzSvc,
  668.     OLECHAR          **pServerPrincName,
  669.     DWORD             *pAuthnLevel,
  670.     DWORD             *pImpLevel,
  671.     RPC_AUTHZ_HANDLE  *pPrivs,
  672.     DWORD             *pCapabilities );
  673. WINOLEAPI CoImpersonateClient();
  674. WINOLEAPI CoRevertToSelf();
  675. WINOLEAPI CoQueryAuthenticationServices(
  676.     DWORD *pcAuthSvc,
  677.     SOLE_AUTHENTICATION_SERVICE **asAuthSvc );
  678. WINOLEAPI CoSwitchCallContext( IUnknown *pNewObject, IUnknown **ppOldObject );
  679.  
  680. #define COM_RIGHTS_EXECUTE 1
  681.  
  682. #endif // DCOM
  683.  
  684. /* helper for creating instances */
  685.  
  686. WINOLEAPI CoCreateInstance(REFCLSID rclsid, LPUNKNOWN pUnkOuter,
  687.                     DWORD dwClsContext, REFIID riid, LPVOID FAR* ppv);
  688.  
  689.  
  690. #if (_WIN32_WINNT >= 0x0400 ) || defined(_WIN32_DCOM) // DCOM
  691.  
  692. WINOLEAPI CoGetInstanceFromFile(
  693.     COSERVERINFO *              pServerInfo,
  694.     CLSID       *               pClsid,
  695.     IUnknown    *               punkOuter, // only relevant locally
  696.     DWORD                       dwClsCtx,
  697.     DWORD                       grfMode,
  698.     OLECHAR *                   pwszName,
  699.     DWORD                       dwCount,
  700.     MULTI_QI        *           pResults );
  701.  
  702. WINOLEAPI CoGetInstanceFromIStorage(
  703.     COSERVERINFO *              pServerInfo,
  704.     CLSID       *               pClsid,
  705.     IUnknown    *               punkOuter, // only relevant locally
  706.     DWORD                       dwClsCtx,
  707.     struct IStorage *           pstg,
  708.     DWORD                       dwCount,
  709.     MULTI_QI        *           pResults );
  710.  
  711. WINOLEAPI CoCreateInstanceEx(
  712.     REFCLSID                    Clsid,
  713.     IUnknown    *               punkOuter, // only relevant locally
  714.     DWORD                       dwClsCtx,
  715.     COSERVERINFO *              pServerInfo,
  716.     DWORD                       dwCount,
  717.     MULTI_QI        *           pResults );
  718.  
  719. #endif // DCOM
  720.  
  721.  
  722. /* other helpers */
  723.  
  724. WINOLEAPI StringFromCLSID(REFCLSID rclsid, LPOLESTR FAR* lplpsz);
  725. WINOLEAPI CLSIDFromString(LPOLESTR lpsz, LPCLSID pclsid);
  726. WINOLEAPI StringFromIID(REFIID rclsid, LPOLESTR FAR* lplpsz);
  727. WINOLEAPI IIDFromString(LPOLESTR lpsz, LPIID lpiid);
  728. WINOLEAPI_(BOOL) CoIsOle1Class(REFCLSID rclsid);
  729. WINOLEAPI ProgIDFromCLSID (REFCLSID clsid, LPOLESTR FAR* lplpszProgID);
  730. WINOLEAPI CLSIDFromProgID (LPCOLESTR lpszProgID, LPCLSID lpclsid);
  731. WINOLEAPI_(int) StringFromGUID2(REFGUID rguid, LPOLESTR lpsz, int cbMax);
  732.  
  733. WINOLEAPI CoCreateGuid(GUID FAR *pguid);
  734.  
  735. WINOLEAPI_(BOOL) CoFileTimeToDosDateTime(
  736.                  FILETIME FAR* lpFileTime, LPWORD lpDosDate, LPWORD lpDosTime);
  737. WINOLEAPI_(BOOL) CoDosDateTimeToFileTime(
  738.                        WORD nDosDate, WORD nDosTime, FILETIME FAR* lpFileTime);
  739. WINOLEAPI  CoFileTimeNow( FILETIME FAR* lpFileTime );
  740.  
  741.  
  742. WINOLEAPI CoRegisterMessageFilter( LPMESSAGEFILTER lpMessageFilter,
  743.                                 LPMESSAGEFILTER FAR* lplpMessageFilter );
  744.  
  745. #if (_WIN32_WINNT >= 0x0400 ) || defined(_WIN32_DCOM) // DCOM
  746. WINOLEAPI CoRegisterChannelHook( REFGUID ExtensionUuid, IChannelHook *pChannelHook );
  747. #endif // DCOM
  748.  
  749.  
  750. /* TreatAs APIS */
  751.  
  752. WINOLEAPI CoGetTreatAsClass(REFCLSID clsidOld, LPCLSID pClsidNew);
  753. WINOLEAPI CoTreatAsClass(REFCLSID clsidOld, REFCLSID clsidNew);
  754.  
  755.  
  756. /* the server dlls must define their DllGetClassObject and DllCanUnloadNow
  757.  * to match these; the typedefs are located here to ensure all are changed at
  758.  * the same time.
  759.  */
  760.  
  761. //#ifdef _MAC
  762. //typedef STDAPICALLTYPE HRESULT (* LPFNGETCLASSOBJECT) (REFCLSID, REFIID, LPVOID *);
  763. //#else
  764. typedef HRESULT (STDAPICALLTYPE * LPFNGETCLASSOBJECT) (REFCLSID, REFIID, LPVOID *);
  765. //#endif
  766.  
  767. //#ifdef _MAC
  768. //typedef STDAPICALLTYPE HRESULT (* LPFNCANUNLOADNOW)(void);
  769. //#else
  770. typedef HRESULT (STDAPICALLTYPE * LPFNCANUNLOADNOW)(void);
  771. //#endif
  772.  
  773. STDAPI  DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID FAR* ppv);
  774.  
  775. STDAPI  DllCanUnloadNow(void);
  776.  
  777.  
  778. /****** Default Memory Allocation ******************************************/
  779. WINOLEAPI_(LPVOID) CoTaskMemAlloc(ULONG cb);
  780. WINOLEAPI_(LPVOID) CoTaskMemRealloc(LPVOID pv, ULONG cb);
  781. WINOLEAPI_(void)   CoTaskMemFree(LPVOID pv);
  782.  
  783. /****** DV APIs ***********************************************************/
  784.  
  785.  
  786. WINOLEAPI CreateDataAdviseHolder(LPDATAADVISEHOLDER FAR* ppDAHolder);
  787.  
  788. WINOLEAPI CreateDataCache(LPUNKNOWN pUnkOuter, REFCLSID rclsid,
  789.                                         REFIID iid, LPVOID FAR* ppv);
  790.  
  791.  
  792.  
  793.  
  794. /****** Storage API Prototypes ********************************************/
  795.  
  796. #define STORAGE_NONPERSISTENT  0x535447
  797.  
  798. WINOLEAPI StgCreateDocfile(const OLECHAR FAR* pwcsName,
  799.             DWORD grfMode,
  800.             DWORD reserved,
  801.             IStorage FAR * FAR *ppstgOpen);
  802.  
  803. WINOLEAPI StgCreateDocfileOnILockBytes(ILockBytes FAR *plkbyt,
  804.                     DWORD grfMode,
  805.                     DWORD reserved,
  806.                     IStorage FAR * FAR *ppstgOpen);
  807.  
  808. WINOLEAPI StgOpenStorage(const OLECHAR FAR* pwcsName,
  809.               IStorage FAR *pstgPriority,
  810.               DWORD grfMode,
  811.               SNB snbExclude,
  812.               DWORD reserved,
  813.               IStorage FAR * FAR *ppstgOpen);
  814. WINOLEAPI StgOpenStorageOnILockBytes(ILockBytes FAR *plkbyt,
  815.                   IStorage FAR *pstgPriority,
  816.                   DWORD grfMode,
  817.                   SNB snbExclude,
  818.                   DWORD reserved,
  819.                   IStorage FAR * FAR *ppstgOpen);
  820.  
  821. WINOLEAPI StgIsStorageFile(const OLECHAR FAR* pwcsName);
  822. WINOLEAPI StgIsStorageILockBytes(ILockBytes FAR* plkbyt);
  823.  
  824. WINOLEAPI StgSetTimes(OLECHAR const FAR* lpszName,
  825.                    FILETIME const FAR* pctime,
  826.                    FILETIME const FAR* patime,
  827.                    FILETIME const FAR* pmtime);
  828.  
  829. WINOLEAPI StgOpenAsyncDocfileOnIFillLockBytes( IFillLockBytes *pflb,
  830.              DWORD grfMode,
  831.              DWORD asyncFlags,
  832.              IStorage **ppstgOpen);
  833.  
  834. WINOLEAPI StgGetIFillLockBytesOnILockBytes( ILockBytes *pilb,
  835.              IFillLockBytes **ppflb);
  836.  
  837. WINOLEAPI StgGetIFillLockBytesOnFile(OLECHAR const *pwcsName,
  838.              IFillLockBytes **ppflb);
  839.  
  840.  
  841. WINOLEAPI StgOpenLayoutDocfile(OLECHAR const *pwcsDfName,
  842.              DWORD grfMode,
  843.              DWORD reserved,
  844.              IStorage **ppstgOpen);
  845.  
  846.  
  847.  
  848. //
  849. //  Moniker APIs
  850. //
  851.  
  852. WINOLEAPI  BindMoniker(LPMONIKER pmk, DWORD grfOpt, REFIID iidResult, LPVOID FAR* ppvResult);
  853. WINOLEAPI  CoGetObject(LPCWSTR pszName, BIND_OPTS *pBindOptions, REFIID riid, void **ppv);
  854. WINOLEAPI  MkParseDisplayName(LPBC pbc, LPCOLESTR szUserName,
  855.                 ULONG FAR * pchEaten, LPMONIKER FAR * ppmk);
  856. WINOLEAPI  MonikerRelativePathTo(LPMONIKER pmkSrc, LPMONIKER pmkDest, LPMONIKER
  857.                 FAR* ppmkRelPath, BOOL dwReserved);
  858. WINOLEAPI  MonikerCommonPrefixWith(LPMONIKER pmkThis, LPMONIKER pmkOther,
  859.                 LPMONIKER FAR* ppmkCommon);
  860. WINOLEAPI  CreateBindCtx(DWORD reserved, LPBC FAR* ppbc);
  861. WINOLEAPI  CreateGenericComposite(LPMONIKER pmkFirst, LPMONIKER pmkRest,
  862.     LPMONIKER FAR* ppmkComposite);
  863. WINOLEAPI  GetClassFile (LPCOLESTR szFilename, CLSID FAR* pclsid);
  864.  
  865. WINOLEAPI  CreateClassMoniker(REFCLSID rclsid, LPMONIKER FAR* ppmk);
  866.  
  867. WINOLEAPI  CreateFileMoniker(LPCOLESTR lpszPathName, LPMONIKER FAR* ppmk);
  868.  
  869. WINOLEAPI  CreateItemMoniker(LPCOLESTR lpszDelim, LPCOLESTR lpszItem,
  870.     LPMONIKER FAR* ppmk);
  871. WINOLEAPI  CreateAntiMoniker(LPMONIKER FAR* ppmk);
  872. WINOLEAPI  CreatePointerMoniker(LPUNKNOWN punk, LPMONIKER FAR* ppmk);
  873.  
  874. WINOLEAPI  GetRunningObjectTable( DWORD reserved, LPRUNNINGOBJECTTABLE FAR* pprot);
  875.  
  876. #ifndef RC_INVOKED
  877. #include <poppack.h>
  878. #endif // RC_INVOKED
  879.  
  880. #endif     // __OBJBASE_H__
  881.